
/**   
 * @Title: SystemConfiguration.java 
 * @Package: com.aft.jlgh.modules.base 
 * @Description: TODO
 * @author Mandarava  
 * @date 2016年5月19日 下午2:46:54 
 * @version 1.3.1 
 * @Email wuyan1688@qq.com
 */

package com.aft.terra.modules.basic;

import java.util.List;

import java.util.Map;

import com.aft.terra.app.Constants;
import com.aft.terra.common.utils.RedisKit;
import com.aft.terra.modules.basic.model.Adver;
import com.aft.terra.modules.basic.model.Config;
import com.aft.terra.modules.basic.model.Configuation;
import com.jfinal.plugin.redis.Cache;
import com.jfinal.weixin.sdk.api.ApiConfig;

/**
 * @author Mandarava
 * @date 2016年5月19日 下午2:46:54
 * @version V1.3.1
 */

public class SystemConfiguration {

	private static String shopVersion;

	private static String wxAppId;

	private static String wxAppSecret;

	private static String wxToken;

	private static String redirectUri;

	private static String wxMacId;

	private static String notifyUrl;

	private static String wxPaternerKey;

	private static String codeUrl;

	private static String openIdUrl;

	private static String paymentUrl;

	private static String qfAppCode;

	private static String appName;

	private static String apiToken;

	private static String apiUri;

	private static ApiConfig apiConfig;

	private static String time;

	private static String jsapiTicket;

	private static String signature;

	private static String nonce;

	private static Map<String, String> map;

	private static List<Adver> adver;

	public static void initConfiguration() {
		Configuation config = Configuation.dao.config();
		Config.dao.config();
		Adver.dao.adver();
		shopVersion = config.getVersion();
		wxAppId = config.getWxAppId();
		wxAppSecret = config.getWxAppSecret();
		wxToken = config.getWxToken();
		wxMacId = config.getWxMacId();
		notifyUrl = config.getNotifyUrl();
		redirectUri = config.getRedirectUri();
		wxPaternerKey = config.getWxPaternerKey();
		codeUrl = config.getCodeUrl();
		openIdUrl = config.getOpenIdUrl();
		paymentUrl = config.getPaymentUrl();
		qfAppCode = config.getQfAppCode();
		appName = config.getAppName();
		apiToken = config.getApiToken();
		apiUri = config.getApiUri();
		apiConfig = new ApiConfig(wxToken, wxAppId, wxAppSecret);

	}

	public static List<Adver> getAdverList() {
		adver = RedisKit.getCache().get(Constants.GAME_ADVER);
		return adver;
	}

	public static Map<String, String> getMap() {
		Cache cache = RedisKit.getCache();
		if (!cache.exists(Constants.GAME_CONFIG_PARAMS)) {
			Config.dao.config();
		}
		return cache.get(Constants.GAME_CONFIG_PARAMS);
	}

	public static String getNonce() {
		return nonce;
	}

	public static void setNonce(String nonce) {
		SystemConfiguration.nonce = nonce;
	}

	public static String getAppName() {
		return appName;
	}

	public static void setAppName(String appName) {
		SystemConfiguration.appName = appName;
	}

	public static String getApiToken() {
		return apiToken;
	}

	public static void setApiToken(String apiToken) {
		SystemConfiguration.apiToken = apiToken;
	}

	public static String getApiUri() {
		return apiUri;
	}

	public static void setApiUri(String apiUri) {
		SystemConfiguration.apiUri = apiUri;
	}

	public static String getShopVersion() {
		return shopVersion;
	}

	public static void setShopVersion(String shopVersion) {
		SystemConfiguration.shopVersion = shopVersion;
	}

	public static String getWxAppId() {
		return wxAppId;
	}

	public static void setWxAppId(String wxAppId) {
		SystemConfiguration.wxAppId = wxAppId;
	}

	public static String getWxAppSecret() {
		return wxAppSecret;
	}

	public static void setWxAppSecret(String wxAppSecret) {
		SystemConfiguration.wxAppSecret = wxAppSecret;
	}

	public static String getWxToken() {
		return wxToken;
	}

	public static void setWxToken(String wxToken) {
		SystemConfiguration.wxToken = wxToken;
	}

	public static String getRedirectUri() {
		return redirectUri;
	}

	public static void setRedirectUri(String redirectUri) {
		SystemConfiguration.redirectUri = redirectUri;
	}

	public static String getWxMacId() {
		return wxMacId;
	}

	public static void setWxMacId(String wxMacId) {
		SystemConfiguration.wxMacId = wxMacId;
	}

	public static String getNotifyUrl() {
		return notifyUrl;
	}

	public static void setNotifyUrl(String notifyUrl) {
		SystemConfiguration.notifyUrl = notifyUrl;
	}

	public static String getWxPaternerKey() {
		return wxPaternerKey;
	}

	public static void setWxPaternerKey(String wxPaternerKey) {
		SystemConfiguration.wxPaternerKey = wxPaternerKey;
	}

	public static ApiConfig getApiConfig() {
		return apiConfig;
	}

	public static void setApiConfig(ApiConfig apiConfig) {
		SystemConfiguration.apiConfig = apiConfig;
	}

	public static String getCodeUrl() {
		return codeUrl;
	}

	public static void setCodeUrl(String codeUrl) {
		SystemConfiguration.codeUrl = codeUrl;
	}

	public static String getOpenIdUrl() {
		return openIdUrl;
	}

	public static void setOpenIdUrl(String openIdUrl) {
		SystemConfiguration.openIdUrl = openIdUrl;
	}

	public static String getPaymentUrl() {
		return paymentUrl;
	}

	public static void setPaymentUrl(String paymentUrl) {
		SystemConfiguration.paymentUrl = paymentUrl;
	}

	public static String getQfAppCode() {
		return qfAppCode;
	}

	public static void setQfAppCode(String qfAppCode) {
		SystemConfiguration.qfAppCode = qfAppCode;
	}

	public static String getTime() {
		return time;
	}

	public static void setTime(String time) {
		SystemConfiguration.time = time;
	}

	public static String getJsapiTicket() {
		return jsapiTicket;
	}

	public static void setJsapiTicket(String jsapiTicket) {
		SystemConfiguration.jsapiTicket = jsapiTicket;
	}

	public static String getSignature() {
		return signature;
	}

	public static void setSignature(String signature) {
		SystemConfiguration.signature = signature;
	}

}
